import Router from '@koa/router'

interface IResponse {
  code: number
  data: {
    id: string
    title: string
  }[]
  msg: string
}

const router = new Router()

router.get('/topics', async (ctx) => {
  const res: IResponse = {
    code: 2000,
    data: [
      { id: '001', title: 'Koa with Typescript.' },
      { id: '002', title: 'Build Koa with RollupJs' },
    ],
    msg: 'ok',
  }

  ctx.body = res
})

export default router
